<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Rbac extends CI_Model{
  function __construct(){
   parent::__construct();
   $this->load->database();
   
  }
  //传一个用户名 或得其角色和权限信息
  function getAll($uname){
      $this->db->select('u_name,users.u_id,role_name,perm_name,login_time');
      $this->db->from('users');
      $this->db->join('user_role','users.u_id=user_role.u_id');
      $this->db->join('roles','roles.role_id=user_role.role_id');
      $this->db->join('role_perm','role_perm.role_id=roles.role_id');
      $this->db->join('permissions','permissions.perm_id=role_perm.perm_id');
      $this->db->where('u_name',$uname);
      $query=$this->db->get();
      return $query->result();
    
  }

}